package com.wpj.service.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.wpj.entity.Goods;
import com.wpj.mapper.IGoodsMapper;
import com.wpj.service.IGoodService;
import com.wpj.service.ISearchService;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class GoodsServiceImpl extends BaseServiceImpl<Goods> implements IGoodService {

    @Autowired
    private IGoodsMapper iGoodsMapper;

    @Override
    public BaseMapper<Goods> getMapper() {
        return iGoodsMapper;
    }

    @Reference
    private ISearchService searchService;

    @Override
    public int insert(Goods goods) {
        int insert = super.insert(goods);
        searchService.addGoods(goods);
        return insert;
    }
}
